package se.sll.itintegration.catalogue.capacity.service;

import com.eviware.soapui.impl.wsdl.WsdlProject;
import com.eviware.soapui.model.support.PropertiesMap;
import com.eviware.soapui.model.testsuite.TestCase;
import com.eviware.soapui.model.testsuite.TestRunner;
import com.eviware.soapui.model.testsuite.TestRunner.Status;
import com.eviware.soapui.model.testsuite.TestSuite;
import static org.junit.Assert.assertEquals;
import org.junit.Test;

/**
 *
 * @author khaleddaham
 */
public class SoapUITest {

    @Test
    public void testCapacityCRUD() throws Exception {
        WsdlProject project = new WsdlProject("soapui/sll-servicecatalogue-capacity-soapui-project.xml");
        TestSuite testSuite = project.getTestSuiteByName("Test Suite");
        TestCase testCase = testSuite.getTestCaseByName("Basic capacity CRUD");

        // create empty properties and run synchronously
        TestRunner runner = testCase.run(new PropertiesMap(), false);
        assertEquals(Status.FINISHED, runner.getStatus());
    }

    @Test
    public void testFailTests() throws Exception {
        WsdlProject project = new WsdlProject("soapui/sll-servicecatalogue-capacity-soapui-project.xml");
        TestSuite testSuite = project.getTestSuiteByName("Test Suite");
        TestCase testCase = testSuite.getTestCaseByName("Basic capacity CRUD");

        // create empty properties and run synchronously
        TestRunner runner = testCase.run(new PropertiesMap(), false);
        assertEquals(Status.FINISHED, runner.getStatus());
    }

}
